package com.sgb.contract.view.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sgb.contract.R;
import com.sgb.contract.databinding.ContractFragmentExaminedetailsBinding;
import com.sgb.contract.model.ApprovalLogBean;
import com.sgb.contract.view.ui.details.ApprovalLogAdapter;
import com.sgb.contract.view.ui.details.ApprovalLogModel;
import com.swgk.core.base.AppLazyFragment;

import java.util.List;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;

/**
 * 描述:合同-审批日志
 *
 * @author qiangHeNooo
 * <p>
 * 时间： 2021.11.03
 */
public class ApprovalLogFragment extends AppLazyFragment {
    private List<ApprovalLogBean> mLogBeanList;
    private ContractFragmentExaminedetailsBinding mBinding;
    private ApprovalLogModel mModel;

    public ApprovalLogFragment(List<ApprovalLogBean> approvalLogBeanList) {
        this.mLogBeanList = approvalLogBeanList;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mBinding = DataBindingUtil.inflate(inflater, R.layout.contract_fragment_examinedetails, container, false);
        return mBinding.getRoot();
    }

    @Override
    protected void initView() {
        mModel = new ViewModelProvider(this).get(ApprovalLogModel.class);

    }

    @Override
    protected void onLazyLoad() {
        if (mLogBeanList == null || mLogBeanList.size() == 0) {
            mBinding.rlNull.setVisibility(View.VISIBLE);
            mBinding.contractRv.setVisibility(View.GONE);
        }
        ApprovalLogAdapter mAdapter = new ApprovalLogAdapter(mLogBeanList);
        mBinding.contractRv.setLayoutManager(new LinearLayoutManager(getActivity()));
        mBinding.contractRv.setAdapter(mAdapter);
    }
}
